<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>工作笔记</title>
</head>

<body>
<h1 style="text-align: center;">工作笔记</h1>
<a href="add" style="margin-left: 52%;">添加笔记</a>
<table border="1" align="center" width="500px;">
  <tr style="background-color:aqua;">
    <th>笔记标题</th>
    <th>笔记分类</th>
    <th>编写时间</th>
    <th>操作</th>
  </tr>
  <c:forEach var="entry" items="${list}" varStatus="status">
    <tr <c:if test="${status.index%2==1}"> style="background-color:aqua;" </c:if>>
      <td>${entry.title}</td>
      <td>${entry.type}</td>
      <td>${entry.createDate}</td>
      <td><a href="get?id=${entry.id}">查看</a>
        <a href="del?id=${entry.id}" onclick="return confirm('确定要删除吗？');">删除</a>
        <a href="up?id=${entry.id}">修改</a>
      </td>
    </tr>
  </c:forEach>
</table>
<div style="text-align: center;">
  <ul>
    <li>共${totalCount }条记录&nbsp;&nbsp; ${currentPageNo }/${totalPageCount }页
      &nbsp;&nbsp;
    <c:if test="${currentPageNo > 1}">
      <a href="home?pageIndex=1">首页</a>
      <a href="home?pageIndex=${currentPageNo-1}">上一页</a>
    </c:if>
    <c:if test="${currentPageNo < totalPageCount }">
      <a href="home?pageIndex=${currentPageNo+1 }">下一页</a>
      <a href="home?pageIndex=${totalPageCount }">最后一页</a>
    </c:if>
    </li>
  </ul>
</div>
</body>
</html>
